Sql with a table with 100000 records slow query

Hi @agaitan026 Can you try like instead of ilike?

1 Like

same not sure what im doing wrong, also where i got total row count?

convert the {{table1.pagination.pageSize}} to an integer by doing:
{{_.toInteger(table1.pagination.pageSize)}}

2 Likes

that will be for total row count? and what about my current query

Hi there,

It looks like MSSQL uses a different syntax instead of limit offset. Does the solution in this post work?

And then retool docs why said Sql in that part? So thats for postgresql maybe?

what i did is moving out to supabase postgresql but now i got this

  • error:true
  • message:"relation "tbl_clientes" does not exist"
  • position:15
  • :arrow_forward:

queryExecutionMetadata:{} 5 keys

  • estimatedResponseSizeBytes:81
  • resourceTimeTakenMs:181
  • isPreview:false
  • resourceType:"postgresql"
  • lastReceivedFromResourceAt:1697829938337

but the table and column does exists

see

also the column named Cedula, what im doing wrong?

the query on retool is:

select * from tbl_Clientes where tbl_Clientes.Cedula ilike {{ '%' + textInput1.value + '%' }}
order by tbl_Clientes.FechaDeSeguimiento
limit {{ table1.pagination.pageSize }}
offset {{ table1.pagination.offset }}

fixed by using this quotes

but now pagination is not working, i cant see the other results, only one page

It looks like your total row count is equal to the page size - total row count should evaluate to the number of all rows (100000)

And yes, you're correct - our docs typically use Postgres as an example!

1 Like

Ok so that should be a new query to count rows and use that var

Yes, you can have a separate query that fetches the total record count

1 Like

but my issue now is when i use filters i can only search the paginated page , it wont look up all dataset (thats what i need when filters are used)

What you mean page size - rowcount?

What this means ?

Be sure any filters used in your pagination query are also used in the total row count query, so each returns the same number of rows.

Hi there,

row count is the total number of records when the data is not paginated.

1 Like

Yea i got that but i have then my select rowcount - what you said?

SELECT
COUNT(*) - {{table1.pagination.pageSize}} as count
FROM
tbl_clientes;

Hi @agaitan026,

Since we're trying to query for the total number of rows possible, you can remove any references to the table's page size.

If you run into questions after removing {{table1.pagination.pageSize}}, we'd love to take a look tomorrow in office hours :blush:

1 Like

Yes it works with and without